@(userForm: Form[Admin.User_Role])(user:User)

@import helper._
@import helper.twitterBootstrap._


@indextemplate(title ="用户权限管理",user) {
	
    <div class="span3">
    @form(action = routes.Admin.usercontrol,  'id -> "userForm") {
		<fieldset class='fieldset1'>
            <legend>UserPriviledge</legend>
            @if(userForm.hasGlobalErrors) { 
		   		<h1>
                <p class="error">
                    @userForm.globalError.message
                </p>
                </h1>
            }
            
            @if(flash.contains("success")) {
            	<h1><font color=red>
                <p class="success">
                    @flash.get("success")
                </p></font>
                </h1>
            }
            @if(flash.contains("deny")) {
            	<h1><font color=red>
                <p class="success">
                    @flash.get("deny")
                </p></font>
                </h1>
            }
            @if(flash.contains("logout")) {
            	<h1><font color=red>
                <p class="success">
                    @flash.get("logout")
                </p></font>
                </h1>
            }
            @checkbox(
            	userForm("addordel"), 
            	'_label -> "添加/删除（选中删除）"
            )
            
            
            @select(
                userForm("uid"), 
                options(User.options), 
                '_label -> "用户名称", 
                '_default -> "请选择用户",
                '_showConstraints -> false
            )
            @select(
                userForm("rid"), 
                options(SecurityRole.options), 
                '_label -> "权限名称", 
                '_default -> "请选择权限",
                '_showConstraints -> false
            )
		    
			<!-- input type="file" name="picture"-->
			
			<p>
				<input type="submit">
			</p>
		</fieldset>
	}
	</div>
	<div class="span3 offset1">
		@select(
               userForm("selectuid"), 
               options(User.options), 
               '_label -> "用户名称", 
               '_default -> "请选择用户",
               '_showConstraints -> false
           )
           
         <div id="userroleshow">
         	
         </div>
	</div>
	<script type="text/javascript">
		$('#selectuid').change(function(evt) {
        //$('#errors').hide();
        var idtoget = $('#selectuid option:selected').val()
        $.ajax({
            type : 'POST',
            url : "@routes.Admin.userroles()",
            data : {
            	selectuid:idtoget
            },
            dataType : "text",
            success : function(data) {
                //setError('Call succedded');
                //$('#test1').attr("src", data)
                //alert(data);
                $('#userroleshow').text(data)
            },
            error : function(data) {
                alert('Make call failed,please contact Administrator');
            }
        });
        
        return false;
    });
	</script>
	 

}
